<?php
/**
 *
 *@package 
 *@copyright Copyright (c) 2012-2014 Tuniu.com
 *@author huxiaomin 2012
 *@version 1.0
 */
  
class IndexApp{

	public $tpl='';//可以自定义模板
	public $cache = 1;
	public $cache_time =1;
	
	function hook($api){
	   if($api == 'index'){
	       return array('tpl'=>'/layout/index/index.layout.html');
	   }
	   elseif($api == 'side'){
	       return array();
	   }
	}
	
	function index(){
	   $this->tpl = '/layout/index/index.layout.html';
	   return array('request'=>'start to use index.layout.html');
	}
	
	/**
	 * 左侧
	 * @param $request
	 */
	function side($request){
	   
	}
	
	
	
	
	
	
	
	
    function get(){
    	
    	$orders = new TMod('OrdersMod');
    	$orders->get();
        $dtask = new DTask();
        $task = array('uri'=>'http://www.tframe.com/restful/d-task-test/test',
                      'request'=>'hello world my restful '.time(),
                      'type'=>'request',
                      'uniqid'=>'',
                      'callback'=>'DTaskTest::test',
                     );

        $id =  $dtask->add($task);
        $task = array('uri'=>'http://www.tframe.com/restful/d-task-test/test',
                      'request'=>'hello world my restful '.time(),
                      'type'=>'request',
                      'last_id'=>$id,
                      'uniqid'=>'',
                      'callback'=>'DTaskTest::test', 
                     );

        $id =  $dtask->add($task);
        $dtask->add_sync($task);
        print_r(DAO::$sql_log);
        
        
        
        return array('task'=>$task);
        
    }
    
    function start(){
        $dtask = new DTask();
        $dtask->start();
        print_r(DAO::$sql_log);
    }
    
    
    function tpl(){
        $this->tpl = '/index/Index.get.html';
        return array('request'=>'start to use tpl');
    }
    
    
}